package com.itheima.article.feign;

import com.itheima.article.dto.ArticleInfoDto;
import com.itheima.common.vo.ResultVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.article.feign
 */
@FeignClient(name = "leadnews-article", contextId = "apArticleFeign")
public interface ApArticleFeign {

    /**
     * 同步时，保存文章数据
     * @param dto
     * @return
     */
    @PostMapping("/api/apArticle/saveArticleInfo")
    ResultVo saveArticleInfo(@RequestBody ArticleInfoDto dto);

    /**
     * 通过文章id查询作者名称
     * @param articleId
     * @return
     */
    @GetMapping("/api/apArticle/getAuthorNameByArticleId/{articleId}")
    ResultVo<String> getAuthorNameByArticleId(@PathVariable(value = "articleId") Long articleId);
}
